'''
Created on Mar 18, 2013

@author: kevinbauer
'''
import sys

import numpy as np
from TrainingData import TrainingData
from TestingData import TestingData
from Recurrent import Recurrent
from Network import Network
from ConstantObj import ConstantObj
from ResultAnalysis import ResultAnalysis



print "start----------"
'''
Traing data and test data from KDD Cup 1999 Data Set
'''

training = TrainingData(sys.argv[1])

recurrent = Recurrent();
network = Network();
resultAnalysis = ResultAnalysis()

normalData = recurrent.normalize(training.training)

print " input data shape is:", normalData.shape

network = recurrent.perceptionLearning(normalData,network)

#
#network = recurrent.BackPropLearing(normalData,network,1000,5,4)

# normalData: whole Training Data Array
# network: neural network class
# sampleDateAmmount: really training used sample  amount 
# repeatTimes: training repeat time
# hiddenNodeAmount: hidden layer node amount


# network.printWeightData()

testing = TestingData(sys.argv[2])

print "testing data shape:",testing.testing.shape

testData = recurrent.normalize(testing.testing)

testResult = recurrent.testData(testData,network)
#testResult = recurrent.testDataByBackProp(testData,network,1000000)
# normalData: whole Training Data Array
# network: neural network class
# testDateAmmount: really tested record amount 

print "test result shape",testResult.shape

errLineNum = resultAnalysis.compareResult(testResult)


#testing.printData()